package com.wiscamp.ninechapters.problems.domain.repositories;

import com.wiscamp.ninechapters.problems.domain.models.exams.Exam;
import com.wiscamp.ninechapters.problems.domain.models.exams.ExamTypeRelation;
import com.wiscamp.ninechapters.problems.domain.models.exams.ScoringRule;
import cube.ddd.common.query.PagedObjects;
import cube.ddd.common.query.PagedQuery;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.util.Collection;

public interface ExamRepository {
    //region exam
    Exam getExam(@Min(0) long id);

    Exam getExamByCode(@NotBlank String examCode, @Min(0) long organizationId);

    Collection<Exam> getExamsByName(@NotBlank String examName, @Min(0) long organizationId);

    Collection<Exam> getExamsByOrganization(@Min(0) long organizationId);

    PagedObjects<Exam> getExamsByQuery(PagedQuery query);

    Exam saveExam(@NotNull Exam exam);

    //endregion

    //region examTypeRelation
    ExamTypeRelation getExamTypeRelation(long id);

    Collection<ExamTypeRelation> getTypeRelationsByExam(@Min(0) long examId);

    ExamTypeRelation saveExamTypeRelation(@NotNull ExamTypeRelation relation);

    boolean deleteExamTypeRelation(@Min(0) long id);
    //endregion

    //region scoringRule
    ScoringRule getScoringRule(long id);

    ScoringRule getScoringRule(@Min(0) long examId, @Min(0) long problemTypeId, @Min(0) long questionTypeId);

    Collection<ScoringRule> getScoringRulesByExam(@Min(0) long examId);

    ScoringRule saveScoringRule(@NotNull ScoringRule rule);

    boolean deleteScoringRule(@Min(0) long id);
    //endregion
}
